/*
 *  repere.cpp
 *  glutMaster
 *
 *  Created by Emmanuel Melin on 19/01/11.
 *  Copyright 2011 __MyCompanyName__. All rights reserved.
 *
 */

#include "repere.h"

 repere::repere(int t){
taille=t;
}

 repere::~repere(){}


void repere::fleche(float t1,float t2,float t3,float taille,char dim){
	switch(dim)
	{
		case 'x': 
			glBegin(GL_LINE_STRIP);
			glVertex3f (t1-taille, t2+taille, t3); 
			glVertex3f (t1, t2, t3); 
			glVertex3f (t1-taille, t2-taille, t3); 	
			glEnd();
			break;
		case 'y': 
			glBegin(GL_LINE_STRIP);
			glVertex3f (t1, t2-taille, t3+taille); 
			glVertex3f (t1, t2, t3); 
			glVertex3f (t1, t2-taille, t3-taille); 	
			glEnd();
			break;
		case 'z': 
			glBegin(GL_LINE_STRIP);
			glVertex3f (t1, t2+taille, t3-taille); 
			glVertex3f (t1, t2, t3); 
			glVertex3f (t1, t2-taille, t3-taille); 	
			glEnd();
			break;
		default :;
	}
}


void repere::trace_repere(){
	float coef=1;
//	glDisable(GL_LIGHTING);
	glLineWidth(1.0);
	glBegin(GL_LINES);
	glColor3f(1.0,0.0,0.0);
	glVertex3f (taille, 0.0, 0.0); 
	glVertex3f (-taille, 0.0, 0.0);
	glColor3f(0.0,1.0,0.0); 
	glVertex3f ( 0.0, 0.0, coef*taille); 
	glVertex3f ( 0.0, 0.0, -taille*coef); 
	glColor3f(0.0,1.0,1.0); 
	glVertex3f ( 0.0, taille, 0.0); 
	glVertex3f ( 0.0, -taille, 0.0); 
	glEnd();
	glColor3f(1.0,0.0,0.0);
	fleche(taille, 0.0, 0.0,taille*0.1 ,'x');	
	glColor3f(0.0,1.0,0.0); 
	fleche(0.0, 0.0, coef*taille,taille*0.1 ,'z');	
	glColor3f(0.0,1.0,1.0); 
	fleche(0.0, taille, 0.0,taille*0.1 ,'y');	
	glLineWidth(0.1);
//	glEnable(GL_LIGHTING);
}

